// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import iView from 'iview';
import 'iview/dist/styles/iview.css';

import axios from './kits/axios.js';

Vue.use(axios);

router.beforeEach((to, from, next) => {
	if(to.path == '/admin' || to.path == '/assortment' || to.path == '/production' || to.path == '/life') {
		if(sessionStorage.isAdmin == '' || sessionStorage.isAdmin == 'undefined' || sessionStorage.isAdmin == 'false') {
			next({
				path: '/'
			})
			return;
		} else if(!sessionStorage.isAdmin) {
			next({
				path: '/'
			})
			return;
		} else {
			next()
		}
	} else {
		next()
	}
});

Vue.config.productionTip = false
Vue.use(iView);

/* eslint-disable no-new */
new Vue({
	el: '#app',
	router,
	render: h => h(App)
})